﻿@{
    ViewBag.Title = "奖金管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
    var tag = ViewData["MoneyType"] == null ? 0 : Convert.ToInt32(ViewData["MoneyType"]);
}
@using JStore.Core.Enums
@using JStore.Web.Controllers.HtmlHelpers
@using SpeadFrm.Extensions
@using SpeadFrm.MvcPager
@model PagedList<JStore.Web.Controllers.MoneyLogs.ViewModels.MoneyLogModel>
<link href="../../Scripts/colorbox/colorbox.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/colorbox/jquery.colorbox-min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $(".box").colorbox({
            iframe: true,
            width: 700,
            height: 500 
        }); 
    })
</script>
<script type="text/javascript">
    function pass(id) {
        if (confirm('是否确定已汇款给对方?')) {
            $.post('@Url.Action("Pass", "MoneyLogs")', { id: id }, function () {
                alert("发放成功");
                window.location.reload();
            });
        }
    }
</script>
<div class="right_box_card">
    <ul>
        <li class="right_box_card1"><a href="@Url.Action("List", "MoneyLogs")">奖金管理</a></li>
        <li class="right_box_card2"><a href="@Url.Action("WeekList", "MoneyLogs")">按周统计</a></li>
    </ul>
</div>
@using (Html.BeginForm("List", "MoneyLogs", FormMethod.Get))
{
    <table class="right_box_tab" style="margin-top: 10px;" width="100%" border="0" cellspacing="0"
        cellpadding="0">
        <tr height="30">
            <td>
                会员账号：@Html.TextBox("UserName", ViewData["UserName"], new { @class = "tab_input" })
            </td>
            <td>
                源会员账号：@Html.TextBox("SourceUserName", ViewData["SourceUserName"], new { @class = "tab_input" })
            </td>
            <td>
                奖金类型：@Html.DropDownList("MoneyType", ViewData["moneyTypeList"] as List<SelectListItem>)
            </td>
            <td>
                <input type="submit" class="submit" value="查询" style="float: left; width: 80px;" />
            </td>
        </tr>
    </table>

}
<table class="right_box_tab" style="margin-top: 10px;" width="100%" border="0" cellspacing="0"
    cellpadding="0">
    <tr height="30" class="tab_title">
        <td>
            Id
        </td>
        <td>
            会员账号
        </td>
        <td>
            源账号
        </td>
        <td>
            业绩类型
        </td>
        <td>
            结算金额
        </td>
        <td>
            结算比率
        </td>
        <td>
            业绩金额
        </td>
        <td>
            复消比率
        </td>
        <td>
            实际发放金额
        </td>
        <td>
            结算时间
        </td>
        <td>
            是否已发放
        </td>
        <td>
            发放时间
        </td>
        <td>
            操作人
        </td>
        <td>
        </td>
    </tr>
    @foreach (var item in Model)
    {
        <tr height="35" class="tab_td1" style="line-height: 26px;" onmouseover="this.className = 'tab_td2' "
            onmouseout=" this.className = 'tab_td1'">
            <td>
                @item.Id
            </td>
            <td class="red">
                @Html.UserDetail(item.UserName)
            </td>
            <td>
                @Html.UserDetail(item.SourceUserName)
            </td>
            <td>
                @(item.MoneyType.ToDescriptionName())
            </td>
            <td>
                @item.BalanceMoney
            </td>
            <td>
                @item.Rate.ToString("p")
            </td>
            <td>
                @item.TotalMoney
            </td>
            <td>
                @item.OtherRate.ToString("p")
            </td>
            <td class="red">
                @item.RealMoney
            </td>
            <td>
                @item.CreateDate
            </td>
            <td>
                @(item.IsSend ? "已发放" : "待发放")
            </td>
            <td>
                @(item.ModifyTime == null ? "-" : item.ModifyTime.ToString())
            </td>
            <td>
                @item.OperUserName
            </td>
            <td>
                @if (!item.IsSend)
                {
                    <a href="javascript:void(0);" onclick="pass(@item.Id)">立即发放</a>
                }
            </td>
        </tr>
    }
</table>
<div style="padding: 10px;">
    @Html.Pager(Model)
</div>
